const express = require('express');
const router = express.Router();
const ApiKeysController = require('../controllers/ApiKeysController');
const { validateApiKeys } = require('../validators/ApiKeysValidator');
const authMiddleware = require('../middleware/authMiddleware');

// 应用认证中间件
router.use(authMiddleware);

// 获取列表
router.get('/', ApiKeysController.getList);

// 获取详情
router.get('/:id', ApiKeysController.getDetail);

// 创建记录
router.post('/', validateApiKeys, ApiKeysController.create);

// 更新记录
router.put('/:id', validateApiKeys, ApiKeysController.update);

// 删除记录
router.delete('/:id', ApiKeysController.delete);

// 批量删除
router.delete('/', ApiKeysController.batchDelete);

module.exports = router;
